<template>
  <div class="page-content">
    <div class="settings" v-if="isUserLogin">
      <el-dropdown>
        <span class="el-dropdown-link">
          设置<i class="el-icon-setting el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item icon="el-icon-s-home" @click.native="toHomePage">主页</el-dropdown-item>
          <el-dropdown-item icon="el-icon-position" @click.native="logout">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>

export default {
  name: 'App',
  methods:{
    async logout() {
      this.$store.dispatch('userLogout');
      this.$router.push('/user/login');
    },
    toHomePage(){
      this.$router.push('/banquet/list');
    }
  },
  computed:{
    isUserLogin(){
      return this.$store.state.user.isLogin;
    }
  }
}
</script>

<style scoped>

.page-content{
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0px;
  border-radius: 10px;
  background: linear-gradient(to right,#f1f4f9,#dff1ff) repeat;
  position: relative;
}

.settings{
  position: absolute;
  top:20px;
  right: 100px;
  z-index: 1;
}

</style>
